﻿namespace NavigationSampleWinForms.Views
{
    using System;
    using System.Windows.Forms;

    using Smart.Navigation;

    /// <summary>
    /// 
    /// </summary>
    [View(ViewId.Menu)]
    public partial class MenuView : AppViewBase
    {
        /// <summary>
        /// 
        /// </summary>
        public MenuView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            // ファンクションキー
            FunctionCotrol.UpdateFunctionKeys(new[]
            {
                new FunctionKey(Keys.F12, "終了")
            });
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonExit()
        {
            Navigator.Exit();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        public override void OnFunctionKey(Keys key)
        {
            switch (key)
            {
                case Keys.F12:
                    Navigator.Exit();
                    break;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuButton1Click(object sender, EventArgs e)
        {
            Navigator.Forward(ViewId.ContextInput1);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuButton2Click(object sender, EventArgs e)
        {
            Navigator.Forward(ViewId.Stack1);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuButton3Click(object sender, EventArgs e)
        {
            Navigator.Forward(ViewId.DataList);
        }
    }
}